package com.dd.dc.utils.req;

import cn.hutool.json.JSONUtil;
import com.dd.dc.base.domain.DResult;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 描述:
 *
 * @author: yanglin
 * @Date: 2021-03-05-11:19
 * @Version: 1.0
 */
public class ReqUtil {

    public static void Retuen(HttpServletResponse httpServletResponse, DResult result) throws IOException {
        //转json字符串并转成Object对象，设置到Result中并赋值给返回值o
        httpServletResponse.setCharacterEncoding("UTF-8");
        httpServletResponse.setContentType("application/json; charset=utf-8");
        PrintWriter out = httpServletResponse.getWriter();
        out.print(JSONUtil.parseObj(result));
        out.flush();
        out.close();
    }
}
